﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Sockets;

namespace Sofire.DataComm.Net.Async
{
    /// <summary>
    /// 异步套接字发送数据后发生的事件参数。
    /// </summary>
    public class AsyncSocketSendEventArgs : AsyncSocketEventArgs
    {
        private int _SendLength;
        /// <summary>
        /// 获取发送的字节数（不包含内部字节）。
        /// </summary>
        public int SendLength
        {
            get
            {
                return this._SendLength;
            }
            internal set
            {
                this._SendLength = value;
            }
        }

        /// <summary>
        /// 获取与发送操作关联的用户自定义数据。
        /// </summary>
        public object UserToken
        {
            get
            {
                return this._AsyncEventArgs.UserToken;
            }
        }

        /// <summary>
        /// 初始化 <see cref="Sofire.DataComm.Net.Async.AsyncSocketExceptionEventArgs"/> 的新实例。
        /// </summary>
        /// <param name="asyncEventArgs">当前事件参数关联的 <see cref="System.Net.Sockets.SocketAsyncEventArgs"/>。</param>
        public AsyncSocketSendEventArgs(SocketAsyncEventArgs asyncEventArgs)
            : base(asyncEventArgs) { }
    }

    /// <summary>
    /// 异步套接字发送数据后发生的事件委托。
    /// </summary>
    /// <param name="sender">事件对象。</param>
    /// <param name="e">事件参数。</param>
    public delegate void AsyncSocketSendEventHandler(object sender, AsyncSocketSendEventArgs e);
}
